home *** CD-ROM | disk | FTP | other *** search
- From: Kay Roemer <roemer@informatik.uni-frankfurt.de>
- Posted-Date: Mon, 25 Oct 93 8:09:40 MEZ
- Received-Date: Mon, 25 Oct 93 08:09:40 +0100
- Message-Id: <9310250709.AA22263@hera.rbi.informatik.uni-frankfurt.de>
- Subject: sleep() ...
- To: mint@atari.archive.umich.edu
- Date: Mon, 25 Oct 93 8:09:40 MEZ
- Mailer: Elm [revision: 70.85]
-
- The following patches make sleep() return whether
- or not it was interrupted by delivery of signals.
- It returns nonzero if it was interrupted by signals.
-
- The diffs are relative to 1.09.
-
- These changes should make it easy to change pipefs
- (to Eric ...) so that it does NOT touch objects
- that could have been kfree()'ed by a signal handler
- while sleep()ing:
-
- Simply change
- sleep(IO_Q, cond);
- into
- if (sleep(IO_Q, cond)) {
- /* Handle interrupted system call */
- }
- where appropriate.
-
- My next message contains diffs to change Fselect()
- so that it really works for multiple processes
- select()ing the same file. I posted that already
- some time ago, but this version makes use of the
- new sleep(), thus giving somewhat cleaner code :-).
-
- Cheers -- Kay.
-
- *** file.h.orig Fri Oct 22 18:50:52 1993
- --- file.h Fri Oct 22 18:52:08 1993
- ***************
- *** 232,238 ****
- * to sleep
- */
- void ARGS_ON_STACK (*nap) P_((unsigned));
- ! void ARGS_ON_STACK (*sleep) P_((int que, long cond));
- void ARGS_ON_STACK (*wake) P_((int que, long cond));
- void ARGS_ON_STACK (*wakeselect) P_((long param));
-
- --- 232,238 ----
- * to sleep
- */
- void ARGS_ON_STACK (*nap) P_((unsigned));
- ! short ARGS_ON_STACK (*sleep) P_((int que, long cond));
- void ARGS_ON_STACK (*wake) P_((int que, long cond));
- void ARGS_ON_STACK (*wakeselect) P_((long param));
-
- *** proc.c.orig Mon Sep 13 21:22:00 1993
- --- proc.c Fri Oct 22 19:58:24 1993
- ***************
- *** 107,112 ****
- --- 107,113 ----
- p->ppid = curproc->pid;
- p->pid = newpid();
- p->sigpending = 0;
- + p->nsigs = 0;
- p->sysstack = (long)(p->stack + STKSIZE - 12);
- p->ctxt[CURRENT].ssp = p->sysstack;
- p->ctxt[SYSCALL].ssp = (long)(p->stack + ISTKSIZE);
- ***************
- *** 451,463 ****
- p->slices = SLICES(p->curpri);
- }
-
- ! void ARGS_ON_STACK
- sleep(que, cond)
- int que;
- long cond;
- {
- PROC *p;
- short sr;
- extern short kintr; /* in bios.c */
- #ifndef MULTITOS
- #ifdef FASTTEXT
- --- 452,465 ----
- p->slices = SLICES(p->curpri);
- }
-
- ! short ARGS_ON_STACK
- sleep(que, cond)
- int que;
- long cond;
- {
- PROC *p;
- short sr;
- + ulong onsigs = curproc->nsigs;
- extern short kintr; /* in bios.c */
- #ifndef MULTITOS
- #ifdef FASTTEXT
- ***************
- *** 478,484 ****
- if (que == READY_Q && !sys_q[READY_Q]) {
- /* we're just going to wake up again right away! */
- do_wakeup_things();
- ! return;
- }
-
- sr = spl7();
- --- 480,486 ----
- if (que == READY_Q && !sys_q[READY_Q]) {
- /* we're just going to wake up again right away! */
- do_wakeup_things();
- ! return (onsigs != curproc->nsigs);
- }
-
- sr = spl7();
- ***************
- *** 548,554 ****
- *((void **)0x44eL) = curproc->logbase;
- #endif
- do_wakeup_things();
- ! return;
- }
- /*
- * save per-process variables here
- --- 550,556 ----
- *((void **)0x44eL) = curproc->logbase;
- #endif
- do_wakeup_things();
- ! return (onsigs != curproc->nsigs);
- }
- /*
- * save per-process variables here
- ***************
- *** 567,572 ****
- --- 569,576 ----
- }
- assert(p->magic == CTXT_MAGIC);
- change_context(&(p->ctxt[CURRENT]));
- + /* not reached */
- + return 0;
- }
-
- /*
- *** proc.h.orig Fri Oct 22 18:38:30 1993
- --- proc.h Fri Oct 22 18:39:56 1993
- ***************
- *** 170,175 ****
- --- 170,177 ----
- ushort sigflags[NSIG]; /* signal flags */
- ulong sigextra[NSIG]; /* additional signals to be masked
- on delivery */
- + ulong nsigs; /* # of delivered signals */
- +
- char *mb_ptr; /* p_msg buffer ptr */
- long mb_long1, mb_long2; /* p_msg storage */
- long mb_mbid; /* p_msg id being waited for */
- *** proto.h.orig Fri Oct 22 18:50:02 1993
- --- proto.h Fri Oct 22 18:50:36 1993
- ***************
- *** 246,252 ****
- void add_q P_((int que, PROC *proc));
- void rm_q P_((int que, PROC *proc));
- void ARGS_ON_STACK preempt P_((void));
- ! void ARGS_ON_STACK sleep P_((int que, long cond));
- void ARGS_ON_STACK wake P_((int que, long cond));
- void ARGS_ON_STACK wakeselect P_((long param));
- void DUMPPROC P_((void));
- --- 246,252 ----
- void add_q P_((int que, PROC *proc));
- void rm_q P_((int que, PROC *proc));
- void ARGS_ON_STACK preempt P_((void));
- ! short ARGS_ON_STACK sleep P_((int que, long cond));
- void ARGS_ON_STACK wake P_((int que, long cond));
- void ARGS_ON_STACK wakeselect P_((long param));
- void DUMPPROC P_((void));
- *** signal.c.orig Fri Sep 17 15:32:58 1993
- --- signal.c Fri Oct 22 20:50:50 1993
- ***************
- *** 265,270 ****
- --- 263,269 ----
-
- extern void sig_return();
-
- + ++curproc->nsigs;
- if (curproc->sighandle[sig] == SIG_IGN)
- return;
- else if (curproc->sighandle[sig] == SIG_DFL) {
-
-